package com.example.shopspring.service.impl;

import com.example.shopspring.common.ResultData;
import com.example.shopspring.dto.StaThirdDto;
import com.example.shopspring.service.StaThirdService;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class StaThirdServiceImpl implements StaThirdService {
    @Override
    public ResultData getStaList() {
        List<Map<String, Object>> goods = new ArrayList<>();
        List<Map<String, Object>> orders = new ArrayList<>();
        String[] stringArray = {"审核中", "销售中", "已下架", "库存预警", "待付款", "待发货", "已发货", "退款中"};
        for (int i = 0; i < stringArray.length; i++) {
            HashMap<String, Object> map = new HashMap<>();
            map.put("label", stringArray[i]);
            map.put("value", new Random().nextInt(100));
            if (i < 4)
                goods.add(map);
            else
                orders.add(map);
        }
        StaThirdDto staThirdDto = new StaThirdDto();
        staThirdDto.setGoods(goods);
        staThirdDto.setOrders(orders);
        return ResultData.success(staThirdDto);
    }
}
